import { request } from "@/utils/request";
const w:any = window;
const base:string = w.location.protocol+"//"+w.location.host
const findLink = function (): Promise<any> {
  return request({
    type: "get",
    url: "/findLink"
  })
}

const findBanner = function (): Promise<any> {
  return request({
    type: "get",
    url: "/showBanner"
  })
}

interface ArtilceParams {
  page: number,
  pagesize: number
}
const findArticle = function (data: ArtilceParams): Promise<any> {
  return request({
    type: "get",
    url: "/findArticle",
    data: data,
    all: true
  })
}

const findShare = function (data: ArtilceParams): Promise<any> {
  return request({
    type: "get",
    url: "/findShare",
    data: data,
    all: true
  })
}

const findCodeLife = function (data: ArtilceParams): Promise<any> {
  return request({
    type: "get",
    url: "/findCodeLife",
    data: data,
    all: true
  })
}

const findLife = function (data: ArtilceParams): Promise<any> {
  return request({
    type: "get",
    url: "/findLife",
    data: data,
    all: true
  })
}
const findManger = function (data: ArtilceParams): Promise<any> {
  return request({
    type: "get",
    url: "/findManger",
    data: data,
    all: true
  })
}

interface DesParams {
  id: number
}
const findArticleDes = function (data: DesParams): Promise<any> {
  return request({
    type: "get",
    url: "/findArticleDes",
    data: data
  })
}

const findShareDes = function (data: DesParams): Promise<any> {
  return request({
    type: "get",
    url: "/findShareDes",
    data: data
  })
}

const findCodeDes = function (data: DesParams): Promise<any> {
  return request({
    type: "get",
    url: "/findCodeDes",
    data: data
  })
}

const findLifeDes = function (data: DesParams): Promise<any> {
  return request({
    type: "get",
    url: "/findLifeDes",
    data: data
  })
}

const findGjDes = function (data: DesParams): Promise<any> {
  return request({
    type: "get",
    url: "/findGjDes",
    data: data
  })
}

const findType = function (): Promise<any> {
  return request({
    type: "get",
    url: "/findType",
  })
}
interface PageArtilceParams {
  page: number,
  pagesize: number,
  type: number
}
const findPageTArticle = function (data: PageArtilceParams): Promise<any> {
  return request({
    type: "get",
    url: "/findPageTArticle",
    data: data,
    all: true
  })
}
export { findLink, base, findBanner, findArticle, findShare, findCodeLife, findLife, findManger, findArticleDes, findShareDes, findCodeDes, findLifeDes, findGjDes, findType, findPageTArticle }